{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f5bdb199",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "学生的成绩为C\n"
     ]
    }
   ],
   "source": [
    "score = int(input(\"请输入成绩:\"))\n",
    "if score>=90 and score<=100:\n",
    "  print(\"学生的成绩为A\")\n",
    "elif score>=80 and score<=90:#elif 不用首行缩进！！\n",
    "  print(\"学生的成绩为B\")\n",
    "elif score>=70 and score<=80:\n",
    "  print(\"学生的成绩为C\")\n",
    "elif score>=60 and socre<=70: # type: ignore\n",
    "    print(\"学生的成绩为D\")\n",
    "else:\n",
    "    print(\"不及格！\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "63b1f8cc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a=1\n",
    "not(a<0) #not 取反"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3dc601df",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'name': '01', 'height': '185', 'age': '17', 'IQ': 250}"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[\"IQ\"]=250#在词典中增\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c90f9565",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'name': '01', 'height': '185', 'age': '17'}"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a={\"name\":\"01\",\"height\":\"185\",\"age\":\"17\"}#键与值\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "ba3fc5d7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{3}\n",
      "{1, 2, 3, 4, 5}\n"
     ]
    }
   ],
   "source": [
    "set1={1,2,3}\n",
    "set2={3,4,5}\n",
    "print(set1&set2)#交集\n",
    "print(set1|set2)#并集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "8a09b9fb",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 2, 3, 4]\n"
     ]
    }
   ],
   "source": [
    "b=[4,2,1,3]\n",
    "b.sort() #顺序   .sort(reverse= Ture)逆序\n",
    "print(b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "ebf41b08",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['a', 1, 2, 3, 4, 5, 6, 7, 8, 10]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[0]=\"a\"#改\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "0eca5047",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 1, 2, 3, 4, 5, 6, 7, 8, 10]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a.remove(9)#删\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "54c5d1b0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a.append(10) #增\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "0144af4a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a=list(range(0,10))#左闭右开\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "8bd6df7c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 2, 3, 4, 5, 6]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a=[1,2,3]\n",
    "b=[4,5,6]\n",
    "c=a+b\n",
    "c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "240e0ae4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello world\n",
      "[1, 2, 3]\n",
      "<class 'list'>\n"
     ]
    }
   ],
   "source": [
    "list1 =[1,2,3,4,\"hello world\",[1,2,3]]#列表\n",
    "print(list1[4])\n",
    "print(list1[-1])\n",
    "print(type(list1[-1]))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "pytorch",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.23"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
